#include "enginemanager.h"
#include <iostream>

using namespace std;

void EngineManager::addRobot(string name,int y_loc,int x_loc){

	robots.push_back(Robot(name,y_loc,x_loc,&world));
}
void EngineManager::promptForNewRobot(bool ask_location){

	string name;
	cout << "Enter robot name:";
	cin >> name;

	int y_coord=0;
	int x_coord=0;

	if(ask_location){
		cout << "Starting Y coordinate: ";
		cin >> y_coord;

		cout << "Starting X coordinate: ";
		cin >> x_coord;
	}

	addRobot(name,y_coord,x_coord);
}

void EngineManager::start(){

	for (int i=0; i < robots.size(); i++)
	{
		string command;
		while(command != "quit")
		{
			robots[i].printStatus();

			cout << "---Input robot command for " << robots[i].getname() << ": ";
			cin >> command;
			robots[i].processcommand(command);
		}
	}
}

void EngineManager::printAllRobotStatus(){

	cout << "Current Robots and locations are: " << endl;
	for(int i=0; i < robots.size(); i++)
	{
		cout << robots[i].getname() << endl;
		robots[i].printStatus();
	}
}

void EngineManager::newMap(int y_size,int x_size){
	EngineManager::map.resetSize(y_size,x_size);
}
